package 继承;

public class Student extends Person{
   private int no;
   private double scoreEn;
   private double scoreMath;
   private double scoreCh;

   public Student(){}

    public Student(int no,double scoreEn,double scoreMath,double scoreCh){
       this.no=no;
       this.scoreCh=scoreCh;
       this.scoreMath=scoreMath;
       this.scoreEn=scoreEn;
    }

    public int getNo() {
        return no;
    }

    public void setNo(int no) {
        this.no = no;
    }

    public double getScoreEn() {
        return scoreEn;
    }

    public void setScoreEn(double scoreEn) {
        this.scoreEn = scoreEn;
    }

    public double getScoreMath() {
        return scoreMath;
    }

    public void setScoreMath(double scoreMath) {
        this.scoreMath = scoreMath;
    }

    public double getScoreCh() {
        return scoreCh;
    }

    public void setScoreCh(double scoreCh) {
        this.scoreCh = scoreCh;
    }

    public double aver(){//平均
      double aver= (this.scoreEn+this.scoreCh+this.scoreMath)/3;
      return aver;
    }

    public double max(){//最大
       double max = Math.max(this.scoreEn,this.scoreMath);
       double max2 = Math.max(max,this.scoreCh);
       return max2;
    }

    public double min(){
       double min = Math.min(this.scoreEn,this.scoreMath);
       double min2 = Math.min(min,this.scoreCh);
       return min2;
    }

    @Override
    public String toString() {
        return "Student{" +
                "no=" + no +
                ", scoreEn=" + scoreEn +
                ", scoreMath=" + scoreMath +
                ", scoreCh=" + scoreCh +
                ", name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", age=" + age +
                ", aver=" + aver() +
                ", max=" + max() +
                ", min=" + min() +
                '}';
    }
}
